<?php

/**
 * Beca filter form base class.
 *
 * @package    auip
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseBecaFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'logo'                  => new sfWidgetFormFilterInput(),
      'nombre'                => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'descripcion'           => new sfWidgetFormFilterInput(),
      'dirigido_a'            => new sfWidgetFormFilterInput(),
      'requisitos'            => new sfWidgetFormFilterInput(),
      'plazo'                 => new sfWidgetFormFilterInput(),
      'fecha_inicio'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'fecha_fin'             => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'universidad_ofrece_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Universidad'), 'add_empty' => true)),
      'registro_activo'       => new sfWidgetFormFilterInput(),
      'tipo_beca'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TipoBeca'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'logo'                  => new sfValidatorPass(array('required' => false)),
      'nombre'                => new sfValidatorPass(array('required' => false)),
      'descripcion'           => new sfValidatorPass(array('required' => false)),
      'dirigido_a'            => new sfValidatorPass(array('required' => false)),
      'requisitos'            => new sfValidatorPass(array('required' => false)),
      'plazo'                 => new sfValidatorPass(array('required' => false)),
      'fecha_inicio'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'fecha_fin'             => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'universidad_ofrece_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Universidad'), 'column' => 'id')),
      'registro_activo'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'tipo_beca'             => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('TipoBeca'), 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('beca_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Beca';
  }

  public function getFields()
  {
    return array(
      'id'                    => 'Number',
      'logo'                  => 'Text',
      'nombre'                => 'Text',
      'descripcion'           => 'Text',
      'dirigido_a'            => 'Text',
      'requisitos'            => 'Text',
      'plazo'                 => 'Text',
      'fecha_inicio'          => 'Date',
      'fecha_fin'             => 'Date',
      'universidad_ofrece_id' => 'ForeignKey',
      'registro_activo'       => 'Number',
      'tipo_beca'             => 'ForeignKey',
    );
  }
}
